package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Describe: 产品介绍内容
 * @author: zly
 * @created: 2022-01-27
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum ProdCodeEnum {
    FAIL_REASON_001("prod_code_001","客户咨询"),
    FAIL_REASON_002("prod_code_002","后续电话跟踪"),
    FAIL_REASON_003("prod_code_003","预约到店"),
    FAIL_REASON_004("prod_code_004","试驾邀请"),
    FAIL_REASON_005("prod_code_005","定购/签署合同"),
    FAIL_REASON_006("prod_code_006","取消交车"),
    FAIL_REASON_007("prod_code_007","顾问-3天回访"),
    ;


    String code;
    String name;


    /**
     * 跟进type获
     * @param code
     * @return
     */
    public static String getDictionaries(String code){
        for (ProdCodeEnum fs : ProdCodeEnum.values()) {
            if(fs.getCode().equals(code)){
                return fs.getName();
            }
        }
        return null;
    }

    public static ProdCodeEnum getByCode(String code) {
        return Stream.of(ProdCodeEnum.values())
                .filter(enums -> enums.code.equals(code))
                .findAny().orElse(null);
    }

}
